﻿@{
    Bundle("jquery_validate");
}

<script type="text/javascript">
    jQuery(document).ready(function(){
        jQuery('@ID("#form")').validate({
            rules: {
                adjustmentMin: {
                    required: true
                },
                adjustmentMax: {
                    required: true
                },
                reserve: {
                    required: true
                },
                exhaustionThreshold: {
                    required: true
                }
            }
        });
        jQuery('@ID("#txt_item")').autocomplete({
            source: function (request, response) {
                jQuery.post('@Html.Raw(Url.Action(Loc.Act("Autocomplete").Ctrl("SalesItem")))', request, response);
            },
            minLength: 3,
            select: function (event, ui) {
                jQuery('@ID("#hidden_item")').val(ui.item.id);
            }
        });
    });
</script>
<form id="@ID("form")" action="@Url.Action(Loc.Act("Set").Ctrl("Stock"))" method="post">
    <input type="hidden" name="flags" value="None" />
    <ul>
        <li>
            <label>@T(Res.Name("Item"))</label>
        </li>
        <li>
            <input id="@ID("hidden_item")" type="hidden" name="itemID" />
            <input id="@ID("txt_item")" type="text" name="itemSKU" />
        </li>
        <li>
            <label>
                @T(Res.Name("AdjustmentMin"))
            </label>
        </li>
        <li>
            <input type="text" name="adjustmentMin" value="@Svc.Numeric(1)" />
        </li>
        <li>
            <label>
                @T(Res.Name("AdjustmentMax"))
            </label>
        </li>
        <li>
            <input type="text" name="adjustmentMax" value="@Svc.Numeric(1000)" />
        </li>
        <li>
            <label>
                @T(Res.Name("Reserve"))
            </label>
        </li>
        <li>
            <input type="text" name="reserve" value="@Svc.Numeric(Decimal.Zero)" />
        </li>
        <li>
            <label>
                @T(Res.Name("ExhaustionThreshold"))
            </label>
        </li>
        <li>
            <input type="text" name="exhaustionThreshold" value="@Svc.Numeric(10)" />
        </li>
        <li>
            <input type="checkbox" name="flags" value="Active" />
            <label>@T(Res.In("API").Of("Enum").Of("StockEntryFlags").Name("Active"))</label>
        </li>
        <li>
            <input type="checkbox" name="flags" value="OversoldAllowed" />
            <label>@T(Res.In("API").Of("Enum").Of("StockEntryFlags").Name("OversoldAllowed"))</label>
        </li>
        <li>
            <input type="checkbox" name="flags" value="ExhaustionNotificationEnabled" />
            <label>@T(Res.In("API").Of("Enum").Of("StockEntryFlags").Name("ExhaustionNotificationEnabled"))</label>
        </li>
    </ul>
    <ul class="bar toolbar">
        <li><button class="button" type="submit">@T(Res.In("Common").Of("Act").Name("Submit"))</button></li>
    </ul>
</form>